<?php 
include_once("../includes/page_utf_class.php");
include("../lang/cn/company_type_config.php");
include_once("../module/product/includes/plugin_tarento_class.php");
$tarento = new Tarento();
$str = "";
if($_GET['member_id']>0){
	$str .= " and a.member_id={$_GET['member_id']}";
}
$sql = "select a.*,b.name,b.qq,b.weixin from ".TARENTO." AS a left join ".MEMBER." AS b ON a.member_id=b.userid where a.relations!='' {$str}";
//=============================
$page = new Page;
$page->listRows=20;
if (!$page->__get('totalRows')){
	$db->query($sql);
	$de['count']=$page->totalRows = $db->num_rows();
}
$de['count']=$de['count']?$de['count']:$_GET['totalRows'];
$sql .= "  limit ".$page->firstRow.",".$page->listRows;
$de['page'] = $page->prompt();
//=============================
$db->query($sql);
$ss=$db->getRows();
foreach($ss as $k)
{
	$sales = $tarento->get_tarento_current_month_sales($k['member_id']);
	$k['self_sales'] = $sales['self_sales'];
	$list[]=$k;
}
$de['list'] = $list;

$tpl->assign("de",$de);
$tpl->assign("config",$config);
$tpl->display("rebate_member_list.htm");
?>